import React from 'react';
import BaseComponent from '../Base/BaseComponent';
import {BackTop, Breadcrumb} from 'antd';
import {Helmet} from "react-helmet";
import {SystemConfig,getPath} from '../../router/router'
import {connect} from 'react-redux';
import {withRouter} from 'react-router-dom'

class ContentWrap extends BaseComponent {
    constructor() {
        super();
    }

    render() {
        return (
            <div style={{padding: '0px 20px'}} className="content-info">
                <Helmet>
                    <title>{SystemConfig.systemShortName}</title>
                </Helmet>

                {
                    getPath(this.props.location.pathname) && getPath(this.props.location.pathname).length ? (
                        <div className="breadcumb-box">
                            <Breadcrumb>
                                {
                                    getPath(this.props.location.pathname).map(item => (
                                        <Breadcrumb.Item key={item.path}><a href="javascript:;">{item.name}</a></Breadcrumb.Item>
                                    ))
                                }
                            </Breadcrumb>
                        </div>
                    ) : null
                }

                <div className="margin-top-10">
                    {this.props.children}
                </div>

                <BackTop/>
            </div>
        )
    }
}
export default withRouter(connect()(ContentWrap))
